// 用户相关 API 接口定义
import { get, post } from '@/utils/request';
import type {
  WechatLoginParams,
  LoginResponse,
  FollowListParams,
  FollowListResponse,
  UserInfo,
  ApiResponse,
} from '@/types';

/**
 * 微信一键登录
 */
export const wechatOneTapLogin = (params: WechatLoginParams) => {
  return post<ApiResponse<LoginResponse>>('/c/user/wx-one-tap-register', params);
};

/**
 * 获取用户信息
 */
export const getUserInfo = () => {
  return get<ApiResponse<UserInfo>>('/c/user/getUserInfo');
};

/**
 * 获取关注列表
 */
export const getFollowList = (params: FollowListParams) => {
  return post<FollowListResponse>('/c/user/getFollowList', params);
};

/**
 * 获取粉丝列表
 */
export const getFansList = (params: FollowListParams) => {
  return post<FollowListResponse>('/c/user/getFollowedList', params);
};

/**
 * 关注用户
 */
export const followUser = (userId: string) => {
  return post<ApiResponse>('/c/user/follow', { userId });
};

/**
 * 取消关注用户
 */
export const unfollowUser = (userId: string) => {
  return post<ApiResponse>('/c/user/unfollow', { userId });
};
